/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package py.com.domain;

import java.io.Serializable;
import java.util.Set;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.SequenceGenerator;
import javax.persistence.Table;

/**
 *
 * @author markos
 */
@Entity
@Table(name = "derivaciones")
@NamedQueries({@NamedQuery(name = "Derivaciones.findAll", query = "SELECT d FROM Derivaciones d"), @NamedQuery(name = "Derivaciones.findByDrDerivacion", query = "SELECT d FROM Derivaciones d WHERE d.drDerivacion = :drDerivacion"), @NamedQuery(name = "Derivaciones.findByDrDescripcion", query = "SELECT d FROM Derivaciones d WHERE d.drDescripcion = :drDescripcion")})
public class Derivaciones implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(generator="derivacionGen", strategy=GenerationType.SEQUENCE)
    @SequenceGenerator(sequenceName="derivaciones_dr_derivacion_seq", name="derivacionGen")
    @Basic(optional = false)
    @Column(name = "dr_derivacion")
    private Integer drDerivacion;
    @Column(name = "dr_descripcion")
    private String drDescripcion;
    @OneToMany(cascade = {CascadeType.MERGE, CascadeType.PERSIST}, mappedBy = "deDerivacion", fetch = FetchType.EAGER)
    private Set<Denuncias> denunciasSet;

    public Derivaciones() {
    }

    public Derivaciones(Integer drDerivacion) {
        this.drDerivacion = drDerivacion;
    }

    public Integer getDrDerivacion() {
        return drDerivacion;
    }

    public void setDrDerivacion(Integer drDerivacion) {
        this.drDerivacion = drDerivacion;
    }

    public String getDrDescripcion() {
        return drDescripcion;
    }

    public void setDrDescripcion(String drDescripcion) {
        this.drDescripcion = drDescripcion;
    }

    public Set<Denuncias> getDenunciasSet() {
        return denunciasSet;
    }

    public void setDenunciasSet(Set<Denuncias> denunciasSet) {
        this.denunciasSet = denunciasSet;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (drDerivacion != null ? drDerivacion.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Derivaciones)) {
            return false;
        }
        Derivaciones other = (Derivaciones) object;
        if ((this.drDerivacion == null && other.drDerivacion != null) || (this.drDerivacion != null && !this.drDerivacion.equals(other.drDerivacion))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "py.com.domain.Derivaciones[drDerivacion=" + drDerivacion + "]";
    }

}
